<template>
  <div class="image-test-container">
    <h3>图片显示测试</h3>
    
    <!-- 测试不同尺寸的图片 -->
    <div class="test-section">
      <h4>器械卡片图片测试</h4>
      <div class="card-grid-test">
        <n-card
          v-for="(testImage, index) in testImages"
          :key="index"
          class="equipment-card-test"
          :bordered="false"
          hoverable
        >
          <n-image
            :src="testImage.src"
            class="equipment-image-test"
            preview-disabled
            object-fit="contain"
            :alt="testImage.name"
            fallback-src="/default_equipment.svg"
          />
          <div class="image-info">
            <n-text strong>{{ testImage.name }}</n-text>
            <n-text depth="3" size="small">{{ testImage.description }}</n-text>
          </div>
        </n-card>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { NCard, NImage, NText } from 'naive-ui';

// 测试图片数据，包含不同尺寸比例的图片
const testImages = ref([
  {
    name: '方形图片',
    description: '1:1 比例测试',
    src: ''
  },
  {
    name: '横向图片',
    description: '16:9 比例测试',
    src: ''
  },
  {
    name: '纵向图片',
    description: '3:4 比例测试',
    src: ''
  },
  {
    name: '超宽图片',
    description: '21:9 比例测试',
    src: ''
  }
]);
</script>

<style scoped>
.image-test-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.test-section {
  margin: 20px 0;
}

.card-grid-test {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.equipment-card-test {
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.equipment-card-test:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.equipment-image-test {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
}

.equipment-card-test:hover .equipment-image-test {
  transform: scale(1.05);
}

.image-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.equipment-card-test :deep(.n-image) {
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
</style>
